'use strict'

import UserService from '../service/UserService.js'

class UserController {

  async create(req, res) {
    try {
      const user = await UserService.create(req.body)
      res.json(user)
    } catch (error) {
      res.status(500).json(error)
    }
  }

  async getAll(req, res) {
    try {
      const users = await UserService.getAll()
      return res.json(users)
    } catch (error) {
      res.status(500).json(error)
    }
  }

}

export default new UserController()